using System;
using Tarkin.InfrastructureLibrary.Core.Basic;
using Tarkin.InfrastructureLibrary.Tests.Core.Basic.TestUtilities.ConcreteClasses;
using NUnit.Framework;

namespace Tarkin.InfrastructureLibrary.Tests.Core.Basic
{
    /// <summary>
    /// PackageTests is the NUnit TestFixture for the Tarkin.InfrastructureLibrary.Core.Basic.Package class.
    /// </summary>
    [TestFixture]
    public class PackageTests
    {
        [Test]
        public void TestDefaultConstructor ()
        {
            Package package = new Package ();

            Assert.IsNotNull ( package );
        }

        [Test]
        public void TestOverloadedConstructorOneParameter ()
        {
            Package package = new Package ( "Package name" );

            Assert.IsNotNull ( package );
            Assert.AreEqual ( "Package name", package.Name );
        }

        [Test]
        public void TestOwnedTypesProperty ()
        {
            Package package = new Package ();
            ConcreteType type = new ConcreteType ( "Type name" );

            Assert.IsNotNull ( package.OwnedTypes );

            package.OwnedTypes.Add ( type );

            Assert.IsTrue ( package.OwnedTypes.Contains ( type ) );
        }

        [Test]
        public void TestNestingPackageProperty ()
        {
            Package package = new Package ();
            Package nestingPackage = new Package ( "Nesting Package name" );

            package.NestingPackage = nestingPackage;

            Assert.IsNotNull ( package.NestingPackage );
            Assert.AreEqual ( "Nesting Package name", package.NestingPackage.Name );
        }

        [Test]
        public void TestNestedPackagesProperty ()
        {
            Package package = new Package ();
            Package nestedPackage = new Package ( "Nested Package name" );

            Assert.IsNotNull ( package.NestedPackages );

            package.NestedPackages.Add ( nestedPackage );

            Assert.IsTrue ( package.NestedPackages.Contains ( nestedPackage ) );
        }
    }
}
